package com.ruge.test.Velocity;

/**
 * 爱丽丝、如歌  创建于 2018/7/11 19:11
 * 说明:  数据库字段类型转换
 */
public class VelocityModelFieldType {
   public String get(String type){
       type =type.toUpperCase();
       if (type.indexOf("VARCHAR")>-1) {
           return "String";
       }else if(type.indexOf("CHAR")>-1){
           return "String";
       }else if(type.indexOf("BLOB")>-1){
           return "byte[]";
       }else if(type.indexOf("TEXT")>-1){
           return "String";
       }else if(type.indexOf("INTEGER")>-1){
           return "Long";
       }else if(type.indexOf("TINYINT")>-1){
           return "Integer";
       }else if(type.indexOf("SMALLINT")>-1){
           return "Integer";
       }else if(type.indexOf("MEDIUMINT")>-1){
           return "Integer";
       }else if(type.indexOf("BIT")>-1){
           return "Boolean";
       }else if(type.indexOf("BIGINT")>-1){
           return "BigInteger";
       }else if(type.indexOf("FLOAT")>-1){
           return "Float";
       }else if(type.indexOf("DOUBLE")>-1){
           return "Double";
       }else if(type.indexOf("DECIMAL")>-1){
           return "BigDecimal";
       }else if(type.indexOf("DATE")>-1){
           return "Date";
       }else if(type.indexOf("TIME")>-1){
           return "Time";
       }else if(type.indexOf("DATETIME")>-1){
           return "Timestamp";
       }else if(type.indexOf("TIMESTAMP")>-1){
           return "Timestamp";
       }else if(type.indexOf("bigint")>-1){
           return "Integer";
       }else if(type.indexOf("YEAR")>-1){
           return "Date";
       }else if(type.indexOf("INT")>-1){
           return "Integer";
       }
       return type;
   }
}
